package com.qiange.manager.dao.impl;

import com.qiange.manager.Student.Student;
import com.qiange.manager.dao.IStudentDao;

import java.util.ArrayList;

public class StudentDaoImpl implements IStudentDao {
    private ArrayList<Student> list = new ArrayList<>();
    @Override
    public boolean add(Student student) {
        return list.add(student);
    }

    @Override
    public ArrayList<Student> findAll() {
        return list;
    }

    @Override
    public boolean remove(int index) {
        Student remove = list.remove(index);
        if (remove == null){
            return false;
        }else {
            return true;
        }

    }

    @Override
    public boolean set(int index, Student student) {
        Student set = list.set(index, student);
        if (set == null){
            return false;
        }else {
            return true;
        }

    }
}
